package com.molichuxing.services.property;

/**
 * @Author: zhaopenghui
 * @Description:
 * @Date: Created in 11:27 2020/08/28
 * @Modified By:
 **/
public enum StatisticsAssetUseTypeEnum {

    /**
     * 租售通
     */
    RENTAL(1, "租售通"),
    /**
     * 批售
     */
    BULK_SALES(2, "批售"),
    /**
     * 实际在库
     */
    ACTUALLY_IN_STOCK(3, "实际在库"),
    /**
     * 公务车
     */
    OFFICIAL_VEHICLE(4, "公务车");

    int value;
    String name;

    StatisticsAssetUseTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        StatisticsAssetUseTypeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static StatisticsAssetUseTypeEnum getEnum(int value) {
        for (StatisticsAssetUseTypeEnum enumerate : StatisticsAssetUseTypeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
